from .base import *

ENV_NAME = 'DEV'

FILES_DIR = os.environ.get('FILES_DIR') or '/tmp'
LOG_DIR = os.environ.get('LOG_DIR') or '%s/logs' % FILES_DIR
if not os.path.exists(FILES_DIR):
    os.makedirs(FILES_DIR)
if not os.path.exists(LOG_DIR):
    os.makedirs(LOG_DIR)
LOG_LEVEL = os.environ.get('LOG_LEVEL') or 'debug'

STATIC_PATH = 'app/static'
UPLOAD_PATH = '%s/upload' % FILES_DIR

# database
DB_HOST = os.environ.get('XP_DB_HOST') or 'localhost'
DB_NAME = os.environ.get('XP_DB_NAME') or 'newpay_dev'
DB_USER = os.environ.get('XP_DB_USER') or 'foo'
DB_PASS = os.environ.get('XP_DB_PASS') or '123456'

############### 安全配置 ################

origins = [
    "http://xpay.tangyu.com",
    "https://localhost.xpay.com",
    "http://localhost",
    "http://localhost:8080",
    "http://172.17.0.1"
]

ALLOWED_URIS = ['/api*', "/static*", 
                "/docs*", "/redoc", "*/openapi.json", 
                "/debug*", 
                "/demo*",
                "/login/",
                '/prjName'
                ]

SM_PRI_KEY = '2AA970DCA2FE9F295E7E19794403080938C77DA6CBC2165D7F9682987D0C863'
SM_PUB_KEY = '6783C2C2706E0C27B82489B8E550B2D18A41DC8C7D9ED22E7B31DC8346C658B5D80111F525D23AC3A280152A40CB41214A8903832E01A6B779E0A331A4CA671F'
SECRET_KEY = '8a81609a885ae99a70f399548f34c2f5'
'''
SERVCIE_URLS = {
    'account-center': os.environ.get('ACCOUNT_CENTER_URL') or 'http://localhost:8082/api',
    'daifu-fe-pf': os.environ.get('DAIFU_FE_PUFA_URL') or 'http://192.168.137.128:3000/api',
}
'''


PAY_CHANNEL_CONFIG = {
    'PF_DAIFU': {
        'service': 'daifu-fe-pf',
        'desc': '浦发代付',
        'pay_type': 'daifu',
        'api_url': SERVCIE_URLS.get('daifu-fe-pf'),
        'bank_code': 'SPDB'
    }
}

# 前置配置
'''
class FrontEnum(Enum):
    "前置枚举配置"
    DAIFU_PUFA = ('daifu-fe-pf', SERVCIE_URLS.get('daifu-fe-pf'), '浦发代付')
    WX_SCAN = ('wx-scan', 'http://localhost:3000', '微信扫码')
'''

class ServiceEnum(Enum):
    "服务枚举配置"
    ACCOUNT_CENTER = ('account-center', SERVCIE_URLS.get('account-center'), '账户中心'),
    DAIFU_PUFA = ('daifu-fe-pf', SERVCIE_URLS.get('daifu-fe-pf'), '浦发代付'),
    WX_SCAN = ('wx-scan', 'http://localhost:3000', '微信扫码')
